<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|在这配置路由
*/

Route::get('/', function () {
    return view('welcome');
});


//路由组，可在其中做访问限制
Route::group([],function(){

	Route::get('/form', function () {
	    return view('form');
	});

	Route::post('/insert', function () {
		echo "add test";
	});
	Route::get('/test', function () {
		echo "is a test";
	});

	Route::get('/admin/user',[
		'as' => 'ulist',
		'uses' => function(){
			echo route('ulist');
		}
	]);

	Route::get('/login',function(){

		echo "login first";
	});

	Route::get('/setting', [
		'uses' =>function(){
			echo "here is setting page";
		}
	]);

	Route::get('/admin',function(){
		echo "后台首页";
	})->middleware('login');

});

Route::get('/setsession',function(){
	session(['uid'=>100,'name'=>'crh']);
});

//访问/usercontroller路径时，会执行Usercontroller中的show方法
Route::get('/usercontroller','UserController@show');

Route::get('/user/edit/{id}','UserController@edit');

//用户删除操作
Route::get('/admin/user/{id}',[
	'as'=>'udelete',
	'uses'=>'UserController@delete'
]);



//评论
Route::get('/user/comment/{id}',[
	'middleware'=>'login',
	'uses' => 'UserController@comment'
]);




//隐式控制器  凡是goods开头的路劲都交给GoodsController处理


Route::resource('goods','GoodsController');


Route::get('qinqiu','UserController@qinqiu');

//文件上传

Route::get('file','UserController@fshow');

Route::post('upload','UserController@fupload');

//cookie操作

Route::get('cookie','UserController@setcookie');

//闪存
Route::get('flash','UserController@flash');

Route::post('flash','UserController@doflash');
//显示闪存结果
Route::get('old','UserController@old');


//response

Route::get('response','UserController@response');

Route::get('goodsk/detail','GoodsController@goodsDetail');

Route::get('goodsk/detail2','GoodsController@goodsDetail2');
